<div id="mainContent">

<form name="myForm" method="post" >
<input type="hidden" name="txtId" id="txtId" />
<table width="1000px" align="center" cellpadding="0" cellspacing="2" style="border: 1px solid #0000FF; background-color: #FFFFFF">
 	<tr bgcolor="#000974">
		<td><div align="center" style="color:#FFFFFF;"><strong>ชื่อ</strong></div></td>
        <td><div align="center" style="color:#FFFFFF;"><strong>นามสกุล</strong></div></td>
      	<td><div align="center" style="color:#FFFFFF;"><strong>สถานภาพ</strong></div></td>
        <td><div align="center" style="color:#FFFFFF;"><strong>เบอร์มือถือ</strong></div></td>
        <td><div align="center" style="color:#FFFFFF;"><strong>ผู้ลงข้อมูล</strong></div></td>
        <td><div align="center" style="color:#FFFFFF;"><strong>วันที่บันทึกข้อมูล</strong></div></td>
        <td><div align="center" style="color:#FFFFFF;"><strong>รายละเอียด</strong></div></td>
 	</tr>
 	
 	<?php 
 		$i = 1;
 	if(isset($studentTable)) {
 			foreach ($studentTable as $row) {
 				echo '<tr align="left"';
				if($i % 2 == 0) {
					echo ' bgColor=#c6e2ff ';
				}
				$i++;
				echo '>'; 
 			?>
	 			<td><?php echo $row->first_name;?></td>
	 			<td><?php echo $row->last_name;?></td>
	 			<td>นักเรียน</td>
	 			<td><?php echo $row->mobile01;?></td>
	 			<td><?php echo $row->create_by;?></td>
	 			<td><?php echo $row->create_date;?></td>
	 			<td align="center">
	 				<input type="image" src="<?=base_url()?>images/detail_b.png" 
	 					onmouseout="toBlack(this);" onmouseover="toColor(this);" 
	 					value="<?=$row->student_id?>" width="25" height="25" onclick="setStuID(this);">
	 				
	 			</td>
	 	  	</tr>		
 	<?php 	}
 		}
 		if(isset($tutorTable)) {
 			foreach ($tutorTable as $row) {
 				echo '<tr align="left"';
				if($i % 2 == 0) {
					echo ' bgColor=#c6e2ff ';
				}
				$i++;
				echo '>'; 
 			?>
	 			<td><?php echo $row->first_name_th;?></td>
	 			<td><?php echo $row->last_name_th;?></td>
	 			<td>ติวเตอร์</td>
	 			<td><?php echo $row->mobile01;?></td>
	 			<td><?php echo $row->create_by;?></td>
	 			<td><?php echo $row->create_date;?></td>
	 			<td>
	 				<?php echo $row->blackList_comment;?>
	 				 <input type="image" src="<?=base_url()?>images/detail_b.png" 
	 					onmouseout="toBlack(this);" onmouseover="toColor(this);" 
	 					value="<?=$row->tutor_id?>" width="25" height="25" onclick="setTutorID(this);">
	 				
	 			</td>
	 	  	</tr>		
 	<?php 	}
 		}
 	?>
</table>
</form>
<script type="text/javascript">
function toBlack(obj) {
	obj.src = '<?=base_url()?>images/detail_b.png';
}
function toColor(obj) {
	obj.src = '<?=base_url()?>images/detail.png';
}
function setID(obj) {
	document.getElementById('txtId').value = obj.value;
	var frm = document.forms["myForm"];
	frm.action = "<?=site_url()?>BlackList/details";
	frm.submit();
}
function setStuID(obj) {
	var frm = document.forms["myForm"];
	frm.action = "<?=site_url()?>StudentInfo/detail/" + obj.value;
	frm.submit();
}
function setTutorID(obj) {
	var frm = document.forms["myForm"];
	frm.action = "<?=site_url()?>TutorInfo/detail/" + obj.value;
	frm.submit();
}
</script>
</div>
